/****************************************************************************
 **
 ** Copyright (C) 2019 SINOSIND, Inc.
 ** All rights reserved.
 ** Author: Sun Haihua <myspl@msn.com>
 ** Contact: SINOSIND 400-060-9902
 **
 ** This file is part of the NJY System.
 **
 ** Commercial Usage
 ** Licensees holding valid NJY Commercial licenses may use this file in
 ** accordance with the NJY Commercial License Agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and SINOSIND.
 **
 ** If you have questions regarding the use of this file, please contact
 ** SINOSIND at http://agrij.com
 **
 ****************************************************************************/

 const { resolve, dirname } = require("path");
 const dir = (...argv) => resolve(__dirname, ...argv);
 const src = (...argv) => dir("src", ...argv);
 const dest = (...argv) => dir('dest', ...argv);
/**
 * 需要下载webpack  webpack-cli 
 * 
 */
 module.exports = {
	 // mode 模式  production生产模式 development开发模式
     mode: "production",
	 //entry 入口文件
     entry: "./startup.js",
	 // output 输出文件
     output: {
		 // path 输出路径
         path: src('../assets/sz/js/'),
		 // 输出文件名称
         filename: "_start_.js"
     },
	 // 插件
	 plugins:[
		 // html打包插件
		 new HtmlWabpackPlugin(option:{
			 // 复制"./src/index.html" ，并自动引入打包输出的所有资源js、css
			 template:"./src/index.html",
			 // 打包输出的html文件名称
			 filename:"demo.html",    // mode:"production",

			 //压缩html
			 minify:{
				 //移除空格
				 collapsceWhitespace:true,
				 //移除注释
				 removeComment:true
			 }
		 })
	 ],
	 //loader 
     module: {
         rules: [
             {
                 test: /\.js$/,
                 exclude: /node_modules/,
                 loader: 'babel-loader'
             }
         ]
     },
     devServer: {
         //port:6001,
         port: 7080,
         host: '127.0.0.1',
         contentBase: __dirname,
         hot: true,
         proxy: {
             '/api': {
                 target: 'http://192.168.0.121:8384', //Z
                 pathRewrite: {'^/api' : ''}
             }

         }
     }
 };


